package dgut.bbm.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import dgut.bbm.entity.WorkEntity;
import dgut.bbm.service.WorkService;
import dgut.bbm.common.utils.PageUtils;
import dgut.bbm.common.utils.R;



/**
 * 
 *
 * @author seventeen
 * @email 1973182107@qq.com
 * @date 2023-05-06 16:56:08
 */
@RestController
@RequestMapping("bbm/work")
public class WorkController {
    @Autowired
    private WorkService workService;

    /**
     * 列表
     */
    @RequestMapping("/list")
   // @RequiresPermissions("bbm:work:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = workService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
  //  @RequiresPermissions("bbm:work:info")
    public R info(@PathVariable("id") Long id){
		WorkEntity work = workService.getById(id);

        return R.ok().put("work", work);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
   // @RequiresPermissions("bbm:work:save")
    public R save(@RequestBody WorkEntity work){
		workService.save(work);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   // @RequiresPermissions("bbm:work:update")
    public R update(@RequestBody WorkEntity work){
		workService.updateById(work);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("bbm:work:delete")
    public R delete(@RequestBody Long[] ids){
		workService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
